package com.axioma.dbmaint.datalayer.util.datasource.impl;

import javax.sql.DataSource;

import org.postgresql.ds.PGSimpleDataSource;

import com.axioma.dbmaint.datalayer.dto.ServerDTO;
import com.axioma.dbmaint.datalayer.util.datasource.DataSourceFactory;

public class PGDataSourceFactory implements DataSourceFactory {

   @Override
   public DataSource buildDataSource(ServerDTO serverDTO) {
      PGSimpleDataSource pgds = new PGSimpleDataSource();
      pgds.setServerName(serverDTO.getServerName());
      pgds.setPortNumber(serverDTO.getPort());
      pgds.setDatabaseName(serverDTO.getMasterDatabaseName());
      pgds.setUser(serverDTO.getUser());
      pgds.setPassword(serverDTO.getPassword());
      return pgds;
   }

}
